package systempen.cmanager;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class PasswordWall extends Activity {

	EditText tvPassword;
	Button btnOK;



	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		//ThemePicker.onActivityCreateSetTheme(this);
		ThemePicker.onActivityCreateSetTheme(this);
		setContentView(R.layout.password);
		btnOK = (Button) findViewById(R.id.password_buttonOK);
		tvPassword = (EditText) findViewById(R.id.password_enter);
	}

	public void onEnterPassword(View v){
		String pass = tvPassword.getText().toString();
		String dbPassword = util.getFirstDataString("select pass from password where rowid = 1", getApplicationContext());
		if (pass.equals(dbPassword))
		{
			startActivity(new Intent(this, MainActivityTab.class));
			Toast.makeText(this, "Correct!", Toast.LENGTH_SHORT).show();
		}else
		{
			Toast.makeText(this, "Wrong password, please type again.", Toast.LENGTH_SHORT).show();
			tvPassword.setText("");
		}
	}
	
	public void onRecoverPassword (View v)
	{
		startActivity(new Intent(this, PasswordRecover.class));		
	}


}
